<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=windows-1250">
  <meta name="generator" content="PSPad editor, www.pspad.com">
  <title></title>
  
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script> 
  
  <script type="text/javascript">
    $(document).ready(function() {
        var now = new Date();
        var days = localStorage.getItem("days");
        var date;
        var i = 0;
        
        for (i = 0; i <= days; i++) {
                date = new Date(now.getTime() + i * 24 * 60 * 60 * 1000);
                getSubstitution(date, localStorage.getItem("class"));
        }
    });
    
    function getSubstitution(date, myClass)
    {
      var month, day;
      $.ajax({
                  month = date.getMonth() + 1;
                  day = date.getDate();
                  
                  if(day < 10)
                    day = "0" + day;
                    
                  if(month < 10)
                    month = "0" + month;
                  
                  var textDate = date.getFullYear() + "" + month + ""
                            + day;
                            
                  url: "http://sps-tabor.cz/rozvrh-supl/supl/supl_" + textDate + ".htm",
                  async: true,
                  type: "GET",
                  success: function (result) {
                          var i = 0;
                          
                          $("td.C11", result).each(function() {
                            if ($(this).text() == myClass) 
                              pocet++;  
                          });
                  }
                  chrome.browserAction.setBadgeText({text:String(pocet)});
                  chrome.browserAction.setBadgeBackgroundColor({color:[0, 255, 0, 150]});
      });
    }
  </script>
  </head>
  <body>

  </body>
</html>
